﻿namespace Arms.Persistence.Modules.Products.Mappings
{
    using Arms.Domain.Modules.Products;
    using System.Data.Entity.ModelConfiguration;

    internal class MenuCategoryMap : EntityTypeConfiguration<MenuCategory>
    {
        public MenuCategoryMap()
            : base()
        {
            HasMany(x => x.Products).WithMany(x => x.MenuCategories).Map(x =>
            {
                x.ToTable("MenuCategory_Products");
                x.MapLeftKey("MenuCategoryID");
                x.MapRightKey("ProductID");
            });

            HasMany(x => x.ProductGroups).WithMany(x => x.MenuCategories).Map(x =>
            {
                x.ToTable("MenuCategory_ProductGroups");
                x.MapLeftKey("MenuCategoryID");
                x.MapRightKey("ProductGroupID");
            });
        }
    }
}
